home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / univspl / fft_bcb3.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-02  |  1.3 KB  |  49 lines

  1.  
  2. #pragma hdrstop
  3. #include <condefs.h>
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include <math.h>
  7. #include "fftmain.h"
  8.  
  9. //---------------------------------------------------------------------------
  10. USEUNIT("..\src\fftmain.c");
  11. USELIB("..\..\uspl.lib");
  12. //---------------------------------------------------------------------------
  13. #pragma argsused
  14. /*---------------------------------------------------------------------------
  15. Some important notes and issues regarding this program.
  16. remember, the frequency of the sine wave you are generating
  17. *must* be < sample_rate/2, or the waveform will be aliased.
  18. The resolution of the fft in determining the frequency generated
  19. is dependant on sample_rate/fft_size, therefore if you have a high
  20. sample rate and a small fft size, the fft bins are so large that there
  21. is a lot of error in determining the frequency of the sine wave.
  22. ---------------------------------------------------------------------------*/
  23.  
  24. int main(int argc, char **argv)
  25. {
  26. long sample_rate,fft_size;
  27. float freq;
  28.  
  29. /* call is in the form
  30.    fft_xxx freq samp_rate fft_size */
  31.  
  32. if (argc!=4)
  33. {
  34.   printf("Usage:\n");
  35.   printf("%s frequency sample_rate fft_size\n",argv[0]);
  36.   exit(-1);
  37. }
  38.  
  39. /* get parameters */
  40. sample_rate=atoi(argv[2]);
  41. fft_size=atoi(argv[3]);
  42. freq=atof(argv[1]);
  43.  
  44. return fftmain(sample_rate, fft_size, freq);
  45.  
  46.  
  47. }
  48.  
  49.